package cn.haohaowo.webservice.server;

import java.io.IOException;

import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;

import org.apache.ws.security.WSPasswordCallback;

public class ServerPasswordHandler implements CallbackHandler {
	
	private String user = "lwc";
	private String password = "123456";

	public void handle(Callback[] callbacks) throws IOException,
			UnsupportedCallbackException {
		WSPasswordCallback wsPasswordCallback = (WSPasswordCallback)callbacks[0];
		if(user.equals(wsPasswordCallback.getIdentifier())) {
			wsPasswordCallback.setPassword(password);
		}
	}

}
